﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ixyu.Dtos;

namespace Ixyu.Helper
{
    public static class Until
    {
        public static List<FileDto> ToFileList(this string files)
        {
            if (string.IsNullOrEmpty(files))
            {
                return new List<FileDto>();
            }
            return files.Split(',').Select(u => new FileDto()
            {
                Name = u.Substring(u.IndexOf("-")+1),
                Url = u
            }).ToList();
        }

        public static string ToFiles(this IEnumerable<FileDto> list)
        {
            return string.Join(",", list.Select(u => u.Url).ToList());
        }
    }
}
